/**
 *Project: jh-framework
 *File: cn.xkshow.lang.math.RMB.java 
 *Author: hardy(admin@xkshow.cn) Copyright
 ****************************************************************
 *   VERSION       DATE            BY       CHANGE/COMMENT
 * --------------------------------------------------------------
 *    1.0        2013-7-11         hardy         create
 ****************************************************************
 *note:
 ***************************************************************/ 
package cn.xkshow.lang.math;

public class RMB {
    private static final char[] data = new char[]{'零','壹','贰','叁','肆','伍','陆','柒','捌','玖'}; 
    private static final char[] units = new char[]{'元','拾','佰','仟','万','拾','佰','仟','亿'};

    public static String convertNumToUpper(int money){
          StringBuffer sbf = new StringBuffer();
          int unit = 0;
          while(money!=0){
               sbf.insert(0,units[unit++]);
               int number = money%10;
               sbf.insert(0, data[number]);
               money /= 10;
          }
          String retstr = sbf.toString();
          //去零的代码：
          retstr = retstr.replaceAll("零拾零元", "");
          return retstr;
         
    }

    public static void main(String[] args) {
        System.out.println(convertNumToUpper(101));
    }

}
